﻿
namespace Sai.Core.Rules
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using Sai.Core.Introspection;

	public class CheckTypeSealing : IClassRule
	{
        public void Validate(ClassDeclaration was, ClassDeclaration isNow, ITypeDifference typeDifference)
		{
			if (!was.IsSealed && isNow.IsSealed)
			{
				// is now sealed...
				//typeDifference.BaseTypeChanged(wasClass.BaseType, null);
                typeDifference.IdentifiedChange(
                    new UnaryTypeChange(
                        TypeChangeReason.TypeSealed,
                        isNow,
                        "Class is now marked as sealed"
                    ));
			}
		}
	}
}
